﻿var uploadedDataURL = "/asset/get/s/data-1524208379041-rk7-XMw2z.json";

$.get(uploadedDataURL, function (geoJson) {

    myChart.hideLoading();

    echarts.registerMap('江门市', geoJson);

    var allData = {
        "citys":[
            {"name":"蓬江区 42.48%","value":[113.053,22.673],"symbolSize":10,"itemStyle":{"normal":{"color":"#F58158"}}},
            {"name":"江海区 1.58%","value":[113.122,22.543],"symbolSize":2,"itemStyle":{"normal":{"color":"#F58158"}}},
            {"name":"新会区(会城街道) 55.94%","value":[112.989,22.452],"symbolSize":11,"itemStyle":{"normal":{"color":"#F58158"}}}

        ],

        "moveLines":[
            {"fromName":"蓬江区","toName":"江海区","coords":[[112.989,22.452],[113.053,22.673]]},
            {"fromName":"蓬江区","toName":"蓬江区","coords":[[112.989,22.452],[113.122,22.543]]}
        ]
    };

    option = {
        backgroundColor: '#404a59',
        title: {
            text: '现居地为新会区(会城街道)，有意愿购房比例',
            left: 'center',
            textStyle: {
                color: '#fff'
            }
        },
        legend: {
            show: false,
            orient: 'vertical',
            top: 'auto',
            left: 'right',
            data: ['地点', '线路'],
            textStyle: {
                color: '#fff'
            }
        },
        geo: {
            map: '江门市',
            label: {
                //normal:{
                //show: true,
                //textStyle:{
                //color:'#fff',
                //}
                //},
                emphasis: {
                    show: false,
                    textStyle:{
                        color:'#fff',
                    }
                }
            },
            roam: false,
            itemStyle: {
                normal: {
                    areaColor: '#323c48',
                    borderColor: '#404a59'
                },
                emphasis: {
                    areaColor: '#2a333d'
                }
            }
        },
        series: [{
            name: '地点',
            type: 'effectScatter',
            coordinateSystem: 'geo',
            zlevel: 1,
            rippleEffect: {
                brushType: 'stroke',
                period:7,
                scale:26
            },
            label: {
                normal:
                    {
                        show : true,
                        position:'right',
                        formatter:'{b}'
                    },
                emphasis: {
                    show: true,
                    position: 'right',
                    formatter: '{b}'
                }
            },
            symbolSize: 2,
            showEffectOn: 'render',
            itemStyle: {
                normal: {
                    color: '#46bee9'
                }
            },
            data: allData.citys
        }, {
            name: '线路',
            type: 'lines',
            coordinateSystem: 'geo',
            zlevel: 2,
            large: true,
            effect: {
                show: true,
                constantSpeed: 50,
                symbol: 'arrow',//ECharts 提供的标记类型包括 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'
                symbolSize: 10,
                trailLength: 0,
            },
            lineStyle: {
                normal: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                        offset: 0, color: '#58B3CC'
                    }, {
                        offset: 1, color: '#F58158'
                    }], false),
                    width: 2,
                    opacity: 0.6,
                    curveness: 0.2
                }
            },
            data: allData.moveLines
        }]
    };
    myChart.setOption(option);
});
